package org.hibernate.tutorial.hbm;

import java.util.Date;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.tutorial.util.HibernateUtil;

public class TestStudent {
	
	public static void main(String[] args) {
		Student student = new Student();
		student.setId(1);
		student.setName("panjunfeng");
		student.setAge(27);
		student.setBirthday(new Date());
		SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
		Session session = sessionFactory.openSession();
		session.beginTransaction();
		session.save(student);
		session.getTransaction().commit();
		session.close();
		sessionFactory.close();
	}

}
